package tech.aistar.controller.like;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import tech.aistar.service.like.IPraiseService;

/**
 * Created by lenovo on 2019/10/17.
 */
@Component
@EnableScheduling
@EnableAsync//开启多线程
public class PraiseTimeContoller {

    @Autowired
    private IPraiseService praiseService;

    /**
     * 每天定时将点赞数协会数据库中
     */
    @Async
    @Scheduled(cron = "0 0 1 * * ?")
    public void  delRedis() throws InterruptedException{
        praiseService.deleteRedis();
    }

}
